Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rdlc.hw
Class Expression_Constant

    java.lang.Object
      rdlc.hw.Expression_Constant

All Implemented Interfaces:
  Expression

    public class Expression_Constant

extends java.lang.Object
implements Expression

A constant integer expression. Includes bitwidth and base, as well as having a few static final members for common constants. Notice that this refers to a constant in the generated code, and the value may vary from run to run of RDLC.

Version:
  $Revision: 1.5 $
Author:
  Greg Gibeling

Field Summary
`protected int` | `base` The numberical base to print the constant in.
`protected int` | `bitwidth` The bitwidth of this constant.
`static Expression_Constant` | `dontCare` A constant don't care, represented in verilog as 1'bx.
`static Expression_Constant` | `one` The constant 1.
`protected int` | `value` The actual value of this constant.
`static Expression_Constant` | `zero` The constant 0.

Constructor Summary
`Expression_Constant(int _value)` Default constructor for a simple number.
`Expression_Constant(int _bitwidth, int _value, int _base)` Full constructor, simply stores the given parameters.
`Expression_Constant(java.lang.String _value)` Default constructor for a number which includes a base and bitwidth as a string representation.

Method Summary
`int` | `getBase()` Simple accessor.
`int` | `getBitWidth()` Simple accessor.
`int` | `getValue()` Simple accessor.
`boolean` | `isConstant()` Simple accessor.
`boolean` | `isLValue()` Simple accessor.
`boolean` | `isRValue()` Simple accessor.
`java.lang.String` | `toString()` Simple accessor.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### zero

    public static final Expression_Constant zero

  The constant 0.

### one

    public static final Expression_Constant one

  The constant 1.

### dontCare

    public static final Expression_Constant dontCare

  A constant don't care, represented in verilog as 1'bx.

### bitwidth

    protected int bitwidth

  The bitwidth of this constant.

### value

    protected int value

  The actual value of this constant.

### base

    protected int base

  The numberical base to print the constant in.

Constructor Detail

### Expression_Constant

    public Expression_Constant(int _value)

  Default constructor for a simple number. Will attempt to determine the required bitwidth for the given value.

  Parameters:
    `_value` - The value for this constant.

### Expression_Constant

    public Expression_Constant(java.lang.String _value)

  Default constructor for a number which includes a base and bitwidth as a string representation. Calls methods in the library to do the actual parsing.

  Parameters:
    `_value` - The value string for this numberical constant.
  See Also:
    `Library.parseInteger(String)`, `Library.parseBitwidth(String)`

### Expression_Constant

    public Expression_Constant(int _bitwidth,
                               int _value,
                               int _base)

  Full constructor, simply stores the given parameters. Notice that it will also validate the bitwidth and base to ensure that they're positive.

  Parameters:
    `_bitwidth` - The bit width for this number.
    `_value` - The value for this number.
    `_base` - The base for this number.

Method Detail

### isConstant

    public boolean isConstant()

  Description copied from interface: `Expression`
  Simple accessor.

  Specified by:
    `isConstant` in interface `Expression`
  Returns:
    `true` if this expression evaluates to a constant.
  See Also:
    `Expression.isConstant()`

### isLValue

    public boolean isLValue()

  Description copied from interface: `Expression`
  Simple accessor.

  Specified by:
    `isLValue` in interface `Expression`
  Returns:
    `true` if this expression can appear on the left of an assignment.
  See Also:
    `Expression.isLValue()`

### isRValue

    public boolean isRValue()

  Description copied from interface: `Expression`
  Simple accessor.

  Specified by:
    `isRValue` in interface `Expression`
  Returns:
    `true` if this expression can appear on the right of an assignment.
  See Also:
    `Expression.isRValue()`

### getBitWidth

    public int getBitWidth()

  Simple accessor.

  Returns:
    The bitwidth of this number.

### getValue

    public int getValue()

  Simple accessor.

  Returns:
    The value of this number.

### getBase

    public int getBase()

  Simple accessor.

  Returns:
    The base of this number.

### toString

    public java.lang.String toString()

  Simple accessor.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    A human readable representation of this expression for debugging.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD